package com.ygou.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ygou.pojo.UserRanks;
import com.ygou.pojo.UserRanksExample;
import com.ygou.pojo.UsersExample;
import com.ygou.pojo.UserRanksExample.Criteria;
import com.ygou.pojo.Users;
import com.ygou.service.UserRanksService;
import com.ygou.service.UsersService;

@Controller
@RequestMapping(value="/userRanks")
@SessionAttributes(value={"ranks","ucount"})
public class UserRanksController{
	@Autowired
	UserRanksService userRanksService;
	@Autowired
	UsersService usersService;
	@RequestMapping(value="/selectByExample")
	public String selectByExample(@RequestParam(value="currPageNo",defaultValue="1") Integer currPageNo,
			@RequestParam(value="pageSize",defaultValue="10") Integer pageSize,ModelMap model,Integer rankid){
		PageHelper.startPage(currPageNo, pageSize);
		List<UserRanks> ranks=userRanksService.selectRanksGroup();
		List<Users> list=usersService.findByWhere(null, null,rankid);
		int count=usersService.countByExample();
		PageInfo<Users> pages=new PageInfo<Users>(list,pageSize);
		model.put("ucount", count);
		model.put("ranks", ranks);
		model.put("pageInfo", pages);
		return "/admin/member-Grading";

	}
	
}
